package com.amnc.service;

import java.io.File;

public class MoveFiles {	
	/**
	 * �ƶ��ļ���ָ������Ŀ¼
	 * @param oldPath
	 * @param newPath
	 * @return
	 */
	public static String  moveFiles(String oldPath,String newPath){	
		File f=new File(oldPath);
	      File fileList[]=f.listFiles();
	      if (fileList.length>0) {
	    	  for(int i=0;i<fileList.length ;i++) {
	    		   fileList[i].renameTo(new File(newPath+"\\"+fileList[i].getName()));
	    		   System.out.println(" "+fileList[i].getName());
	    		     } 	 
	    	  return "yes";
		}else {
			return "no";
		}
	     
		
	}
	/**
	 * �������ɾ��excel
	 * @param file
	 */
	public static void deletefile(File file) {
		if (file.exists()) {
			if (file.isFile()) {
				file.delete();
				System.out.println("�ļ���ɾ��"+file.getName());
			} else if (file.isDirectory()) {
				File files[] = file.listFiles();
				for (int i = 0; i < files.length; i++) {
					deletefile(files[i]);
				}
			}
			file.delete();
		} else {
			System.out.println("��ɾ����ļ������ڣ�" + 'n');
		}
	}

}
